package com.sword.invoier.demo.controller;

import com.sword.common.bean.Result;
import com.sword.invoice.InvoiceManager;
import com.sword.invoice.bean.bo.sales.InvoiceOrder;
import com.sword.invoice.bean.enums.InvoiceChannelEnum;
import com.sword.invoice.repository.AbsBlueInvoiceStrategy;
import com.sword.invoice.solon.utils.SolonContextUtil;
import org.noear.solon.annotation.Controller;
import org.noear.solon.annotation.Mapping;

/**
 * @description: 控制类
 * @author：Lv.RJ
 * @version: 1.0.0
 * @create: 2025/02/17
 **/
@Controller
@Mapping("/sword")
public class SwordController {
    // 测试登录  ---- http://localhost:8081/sword/blueinvoice/lq

    @Mapping("blueinvoice/lq")
    public Result blueinvoice(String type) {
        AbsBlueInvoiceStrategy strategy = SolonContextUtil.create(InvoiceChannelEnum.LQ_INVOICE.getCode(), AbsBlueInvoiceStrategy.class);
        InvoiceOrder invoiceOrder = new InvoiceOrder();
        invoiceOrder.setBillInfoNo(type);
        strategy.setOrder(invoiceOrder);

//        AbsBlueInvoiceStrategy strategy = InvoiceManager.getISInvoiceDriverRepository(InvoiceChannelEnum.LQ_INVOICE, AbsBlueInvoiceStrategy.class);
        Result result = strategy.doInvoiceHandler();
        return result;
    }

}